﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using IndoReputation.Models.BusinessObject;
using IndoReputation.Models.BusinessObject.Collections;
using IndoReputation.Commons;

namespace IndoReputation.Views.ViewModels
{
    public class NewsViewModel
    {
        [Required]
        public Int64 ID
        {
            set;
            get;
        }

        [Required]
        [Display(Name = "Source")]
        public int MediaID
        {
            set;
            get;
        }
        public string MediaName { get; set; }
        public IEnumerable<SelectListItem> Media { get; set; }
        [Display(Name = "Category")]
        public string MediaCategory { get; set; }

        [Required]
        [Display(Name = "Published Date")]
        public System.DateTime DatePublished
        {
            set;
            get;
        }        


        [Required]
        [Display(Name = "News Category")]
        public int NewsCategory
        {
            set;
            get;
        }
        public List<NewsCategory> ListNewsCategory { get; set; }

        //public IEnumerable<SelectListItem> NewsMarkList { get; set; }
        //[Required(ErrorMessage = "You must select an value of news mark")]
        //[Display(Name = "Choose mark")]
        //public String NewsMark { get; set; }
        
        [Required(ErrorMessage = "Please type the Name")]
        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [PlaceHolder("Enter title here")]
        public string Title
        {
            set;
            get;
        }

        [PlaceHolder("Enter sumary here")]
        public string Sumary
        {
            set;
            get;
        }

        [DataType(DataType.MultilineText)]
        [StringLength(2048, ErrorMessage = "String may not be longer than 2048 characters")]
        public string Link
        {
            set;
            get;
        }

        public DateTime? CreateAt
        {
            set;
            get;
        }
        public int? CreateBy
        {
            set;
            get;
        }

        [Display(Name = "Parameter")]
        public List<NewsValuesModel> ListNewsValuesModel { get; set; }

        public bool IsPublished { get; set; }
    }

    public class NewsValuesModel
    {
        public int ID { get; set; }
        public int NewsID { get; set; }

        public int NewsParameterID { get; set; }
        [Display(Name = "Parameter")]
        public string NewsParameterName { get; set; }
        
        public string NewsParameterValue { get; set; }        
        public IEnumerable<SelectListItem> NewsParameterValueList { get; set; }
        
        public string NewsMarkString { get; set; }
        public IEnumerable<SelectListItem> NewsMarkList { get; set; }

        public DateTime CreateAt { get; set; }
        public int CreateBy { get; set; }
    }
}